package com.sgb.kjwl.view.widget;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;

import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ItemCertificateNameBinding;

/**
 * Created by liwei on 2020/10/9.
 */
public class SelfTeamMemberView extends LinearLayout {

    private ItemCertificateNameBinding mBind;

    public SelfTeamMemberView(Context context) {
        this(context, null);
    }

    public SelfTeamMemberView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public SelfTeamMemberView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        init(context);
    }

    private void init(Context context) {
        mBind = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.item_certificate_name, this, true);
    }

    public void setBean(int size) {
        mBind.etCertificateName.setLabelName("证书" + size);
    }

    public String getCertificateName() {
        String name = mBind.etCertificateName.getContent();
        if (!TextUtils.isEmpty(name)) {
            return name;
        }
        return "";
    }

    public void setCertificateName(String name) {
        if (!TextUtils.isEmpty(name)) {
            mBind.etCertificateName.getContent_edt().setText(name);
        }
    }
}
